/** @file */
#include "stdafx.h"
#include "GameObject.h"
#include <OgreBillboardSet.h>

#include <string>

#ifndef __PlasmaBall_h_
#define __PlasmaBall_h_

/** @class PlasmaBall
 *
 *  @brief Class representing a plasma ball.
 *	
 *	@author Disa Feiff Faith
 *
 *  The plasma ball consists of a large transparent globe with a smaller, opaque globe inside, and a particle effect that simulates
 *	the tendrils of a plasma ball.
 */
class PlasmaBall : public GameObject{

public:

	/**
	*	@brief				Enumeration of default tendril texture options. There is an option to not use any tendrils.
	*/
	enum tendrilTexture {TENDRIL_LINE = 0, TENDRIL_FORKED = 1, TENDRIL_NO_TENDRILS = 2};
	/**
	*	@brief				Enumeration of default sphere texture options.
	*/
	enum sphereTexture {TRANSPARENT_REFLECTIVE, SOLID_GRASS, SOLID_ROCKY};
	/**
	*	@brief				Constructor
	* 
	*	@param position		Defines the position of the PlasmaBall in worldspace. The center of the ball will be placed on this point.
	*	@param dynamic		Defines whether the ball will be movable or stationary. True if movable.
	*	@param radius		The radius of the sphere.
	*	@param tessellation	The level of detail of the sphere mesh. 1 corresponds to the lowest number of vertices, 15 the highest. 
	*						If a value lower than 1 is provided, 1 wil be used. If a value higher than 15 is provided, 15 will be used.
	*	@param tt			The texture to use for the tendrils.
	*	@param st			The texture to use for the sphere surface. If one of the solid textures is chosen, no tendrils will be created.
	*
	*/
	PlasmaBall( Ogre::Vector3 position, bool dynamic, float radius = 100, unsigned int tessellation = 1, PlasmaBall::tendrilTexture tt = TENDRIL_LINE, 
					PlasmaBall::sphereTexture st = TRANSPARENT_REFLECTIVE, bool hasLight = false );
	/**
	*	@brief				Destructor
	*/
	~PlasmaBall(void);
    /**
	*	@brief				Unused method, yet.
	*/
	void updateLogic();
	/**
	*	@brief				Must be called prior to placing the object in a scene. Creates all required components of the plasma ball.
	* 
	*	@param sceneMgr		The Ogre::SceneManager that manages the scene where the ball should be placed.
	*	@param id			A unique id, not shared with any other movable object in the scene.
	*
	*/
	virtual void createMovableObject(Ogre::SceneManager* sceneMgr, unsigned int id);

private:

	/**
	*
	*	@brief				Utility class that creates a sphere mesh of the required radius and detail.
	*
	*	@author				Ogre Wiki http://www.ogre3d.org/tikiwiki/ManualSphereMeshes
	*
	*	@param strName		The Mesh's name.
	*	@param r			The sphere's radius.
	*	@param nRings		Number of lines of longitude in the sphere. Defaults to 16.
	*	@param				Number of lines of latitude in the sphere. Also defaults to 16.
	*
	*/
	static void createSphere(const std::string& strName, const float r, const int nRings = 16, const int nSegments = 16);
	/**
	*	@brief				The radius of the plasma ball.
	*/
	float m_radius;
	/**
	*	@brief				The level of detail of the mesh. Ranges from 1 to 15. m_tessellation * 16 gives the number of 
							rings and segments that will be used when creating the meshes for the two spheres.
	*/
	int m_tessellation;
	/**
	*	@brief				The name of the texture used for the tendrils.
	*/
	std::string m_tendrilTexName;
	/**
	*	@brief				The name of the texture used for the outer sphere.
	*/
	std::string m_sphereTexName;
	/**
	*	@brief				Should tendrils be created for this plasma ball?
	*/
	bool m_hasTendrils;
	/**
	*	@brief				Should a light source be added to this plasma ball?
	*/
	bool m_hasLight;
	/**
	*	@brief				The particle system used in this plasma ball.
	*/
	Ogre::ParticleSystem* m_particleSystem;
};

#endif //__PlasmaBall_h_